package com.study.lxy.util;

import com.study.lxy.annotation.MyCompent;
import org.springframework.beans.factory.config.BeanDefinitionHolder;
import org.springframework.beans.factory.support.BeanDefinitionRegistry;
import org.springframework.context.annotation.ClassPathBeanDefinitionScanner;
import org.springframework.core.type.filter.AnnotationTypeFilter;
import org.springframework.stereotype.Component;

import java.util.Set;

public class MyCompentAutoScanner extends ClassPathBeanDefinitionScanner {

    public MyCompentAutoScanner(BeanDefinitionRegistry registry, boolean useDefaultFilters){
        super(registry,useDefaultFilters);
    }

    protected void doFilter(){
        addIncludeFilter(new AnnotationTypeFilter(MyCompent.class));
    }

    @Override
    protected Set<BeanDefinitionHolder> doScan(String... basePackages) {
        return super.doScan(basePackages);
    }
}
